<template>
    <div >
        <span>子组件count:{{count}}</span>&nbsp;&nbsp;&nbsp;<button @click="add">+1</button><br/>
        <span>子组件user:{{user}}</span><br/>
    </div>
</template>

<script>
    export default {
        name: "son",
        data(){
            return {
                msg:'张三',
                count:0,
                user:{
                    name:'lisi',
                    age:18
                }
            }
        },
        methods:{
            add(){
                this.count++;
                this.$emit('addCount',this.count);
            }
        }
    }
</script>

<style scoped>

</style>
